package com.isaac.actm.service.impl;

import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import com.isaac.actm.domain.pojo.User;
import com.isaac.actm.domain.repository.UserRepository;
import com.isaac.actm.service.UserService;

public class UserServiceImpl implements UserService {

    UserRepository repository;
    

    public List<User> getUsers() {
        return repository.findAllUsers();
    }

    @Transactional
    public void saveUser(User transientUser) {
        repository.save(transientUser);
    }

    public User getUserByID(Long userID) {
		return repository.find(userID);
	}

    @Transactional
	public void deleteUser(User user) {
		repository.delete(user.getId());
	}

	public UserRepository getRepository() {
        return repository;
    }

    public void setRepository(UserRepository repository) {
        this.repository = repository;
    }

}
